package com.wufan.day02;

/**
 * 一维数组声明和初始化
 * @author SongWufan
 * @date 2021/3/4 18:32
 */
public class ArrayTest {
    public static void main(String[] args) {

        int num;
        num = 10;
        int id = 1001;

        //声明 静态初始化：初始化与赋值同时进行
        int[] ids = new int[]{1001,1002,1003,1004};

        //动态初始化：初始化与赋值分开进行
        String[] names = new String[5];

        //通过下标调用
        names[0] = "宋吴凡";
        names[1] = "唐志强";
        names[2] = "成诗华";
        names[3] = "何语林";
        names[4] = "贺浩";

        System.out.println(names.length);

        //遍历
        for (int i = 0; i < names.length; i++){
            System.out.println(names[i]);
        }


    }
}
